/**
 * Created by mac on 15-9-21.
 * 微博的刷新和加载更多数据
 * 依赖同级目录下的eventhandle.js
 */
(function( $ ) {

    $.extend({


        //点击刷新微博数据
        'refreshInfo': function() {

            var oRefresh = $('.js-refresh'),
                oRefreshing = $('.js-refreshing');

            oRefresh.on('click', function() {
                var $this = $(this);

                $this.hide();
                oRefreshing.show();
                $.insertInfoContent({'insertFunction':'html'}, function() {
                    //刷新微博成功后执行的回调
                    $this.show();
                    oRefreshing.hide();
                });
            });

        },


        //页面滚动到底部自动加载更多微博
        'loadMoreInfo': function() {
            $.addScrollToBottom();
            $.infoPageStep = $.infoPageStep+1;
            $(window).on('scrollToBottom', function() {
                $.insertInfoContent({'insertFunction':'append', 'pageStep':($.infoPageStep)}, function() {
                    $.canloadInfo = true;
                });
            });

        }


    });

})( jQuery );